<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>新增类别</title>
<link rel="stylesheet" type="text/css" href="../static/css/conmen-header.css"/>
<link rel="stylesheet" href="../static/css/reset.css" />
<link rel="stylesheet" href="../static/css/adddlb.css" />
</head>
<body>
<div class="xtgl"> <a class="dall public" href="superadmin.html">用户管理</a> <a class="chart dactive public" href="categorylist.html">类别管理</a> <a class="mps public" href="categorylist - dusu.html">毒素管理</a> </div>
<div class="user-content">
  <p class="user-admin"><span>当前页面 : </span><a href="dlb.html">大类别管理/</a><a href="adddlb.html" style="color: #58a0fd">新增类别</a></p>
  <form action="categoryAdd" method="post">
    <div class="user-add-infolist">
      <p class="user-add-title">新增小类别</p>
      <ul class="add-list">
        <li class="list-item">
          <label>类别名称</label>
          <input type="text" name="crop_category"/>
        </li>
        <li class="list-item">
          <label>状态</label>
          <input type="radio" name="state" value="1" checked="checked" />
          启用
          <input type="radio" name="state" value="0" />
          禁用 </li>
      </ul>
      <div class="add-option"> <a class="user-save" onclick="baocun()">保存</a><a class="add-back" onclick="history.go(-1)">返回</a> </div>
    </div>
  </form>
</div>
</body>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
	  function baocun(){
	  var tonxinname=$("input[name='toxin_type']").val();
	  var url="jiaoyantoxin";
	  var parms={"toxinname":tonxinname};
	  $.post(url,parms,function(date){
	      var name=JSON.parse(date);
	              
	      if(name==false){
	      document.forms[0].submit();
	      }else{
	         alert("该毒素已经存在");
	         return false;
	      }
	  });
	    
	  }
	</script>
</html>